package com.xbdun.facade.bmp.enumx;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* @ClassName: PlatTypeEnum
* @Description: 平台类型
* @author zhanggt 360730440@qq.com
* @date 2017年4月24日 下午1:22:16
 */
public enum PlatTypeEnum {
		BUSI(1,"企业"),SALESMAN(2,"业务员"),TRANSMAN(3,"运输员"),CUSTOMER(4,"临时员工");
		private int key;
		private String val;
		PlatTypeEnum(int key,String val){
			this.key = key;
			this.val = val;
		}
		public int getKey() {
			return key;
		}
		public String getVal() {
			return val;
		}
		public static PlatTypeEnum getEnum(int key){
			PlatTypeEnum resultEnum=null;
			PlatTypeEnum[] enumAry=PlatTypeEnum.values();
			for(int i=0;i<enumAry.length;i++){
				if(enumAry[i].getKey()==key){
					resultEnum=enumAry[i];
					break;
				}
			}
			return resultEnum;
		}
		
		@SuppressWarnings({ "rawtypes", "unchecked" })
		public static List toList(){
			PlatTypeEnum[] ary = PlatTypeEnum.values();
			List list = new ArrayList();
			for(int i=0;i<ary.length;i++){
				Map<String,String> map = new HashMap<String,String>();
				map.put("key",ary[i].getKey()+"");
				map.put("desc", ary[i].getVal());
				list.add(map);
			}
			return list;
		}
}
